﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DocumentFormat.OpenXml.Spreadsheet;
using DocumentFormat.OpenXml.Packaging;

namespace OPENXMLLib
{
    public static class WorkbookPartExtention
    {
        public static SharedStringTable GetStringTable(this WorkbookPart workbookPart)
        {
            if (workbookPart.SharedStringTablePart == null)
            {
                workbookPart.AddNewPart<SharedStringTablePart>();
                workbookPart.SharedStringTablePart.SharedStringTable = new SharedStringTable();
                workbookPart.SharedStringTablePart.SharedStringTable.Count = 0;
                workbookPart.SharedStringTablePart.SharedStringTable.UniqueCount = 0;
            }
            return workbookPart.SharedStringTablePart.SharedStringTable;
        }
    }
}
